<template>
  <div class="component-makeBudget">
    <div class="component-mainHeader">
      <div class="top">
        <div class="topleft">
          <p>
            <span class="iconfont" style="color:#1abc9a;margin-right:3px;">&#xe607;</span>施工队基础价格表
          </p>
        </div>
        <div class="topright">
          <el-button type="info" @click="$router.go(0)">
            <span style="font-weight:700;margin-right:5px;" class="iconfont">&#xe662;</span>刷新
          </el-button>
        </div>
      </div>
    </div>
    <div class="component-searchHeader">
      <div class="search-header">
        <div class="left-title">
          <p class="left-text">
            <span class="iconfont">&#xe63d;</span> 筛选查询
          </p>
          <div class="right">
            <button @click="currentPage=1;baseConfigSelect();">查询</button>
          </div>
        </div>
      </div>
    </div>
    <div class="component-search-box" style="border:1px solid #E4E4E4;border-top:none;padding: 40px;width:1100px;box-sizing: border-box;margin: 0 auto;">
      <span class="demonstration">费用名称：</span>
      <el-input v-model="itemName" clearable style="width: 350px;"></el-input>
    </div>
    <div class="component-listHeader">
      <div class="search-header">
        <div class="left-title">
          <p class="left-text">
            <span class="iconfont">&#xe61e;</span>
            施工队基础价格表
          </p>
          <div class="right">
            <!-- <el-button v-show="teamInfo.length>0" @click="edit">{{editBtn?'进行编辑':'取消编辑'}}</el-button>
             <el-button style="width:70px;" @click="commit">保存</el-button>-->
          </div>
        </div>
      </div>
    </div>
    <div>
      <div class="table armorlistTable">
        <el-table
          ref="multipleTable"
          tooltip-effect="dark"
          :data="teamInfo"
          style="width: 1100px;margin:0 auto"
          border
        >
          <el-table-column label="序号" align="center" width="70" type="index"></el-table-column>
          <el-table-column label="费用名称" align="center" prop="itemName"></el-table-column>
          <el-table-column label="规格" align="center" prop="itemModel"></el-table-column>
          <el-table-column label="包含内容" align="center" prop="itemContent"> </el-table-column>
          <el-table-column label="单位" align="center" prop="itemUnit"></el-table-column>
          <el-table-column label="单价" align="center">
            <template slot-scope="scope">
              <el-input size="small" type="number" v-model="scope.row.price"  @change.native="commits(scope.row.price,scope.row.priceId,scope.row.itemId)" controls-position="right"></el-input>
            </template>
          </el-table-column>
        </el-table>
      </div>

      <!-- 分页 -->
      <div class="component-paging" v-if="teamInfo.length > 0">
        <div class="table-bottom">
          <div class="bottom-left" style="margin-left: 0px;">
          </div>
          <div class="paging">
            <div class="paging-left">
              <p>
                共
                <span>{{Math.ceil(total/pageSize)}}</span> 页/
                <span>{{total}}</span> 条数据
              </p>
            </div>
            <el-pagination
              background
              @size-change="SizeChange($event,baseConfigSelect,currentPage,pageSize)"
              @current-change="CurrentChange($event,baseConfigSelect,currentPage,pageSize)"
              :current-page="currentPage"
              :page-sizes="[10, 20, 30]"
              :page-size="pageSize"
              layout="sizes, prev, pager, next, jumper"
              :total="total"
            ></el-pagination>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        editBtn: true,
        teamInfo:[{name:'111'}],
        total: 0,// 数据总条数
        pageSize: 10,// 每页显示数据的条数
        currentPage: 1,// 当前显示的页面页码
        itemName:'',//搜索材料名称
      };
    },
    created() {},
    mounted() {
      this.baseConfigSelect();
    },
    methods: {
      // 查询接口
      baseConfigSelect() {
        let that = this,
          suCb = res => {
            this.teamInfo = res.data.data;
            this.total = res.data.rowCount;
          },
          erCb = function(res) {
            console.log(res);
          },
          req = {
            url: "/api/web/proTeam/getTeamSettlementPrice",
            methods: "post",
            data: {pageCurrent:that.currentPage,pageSize:that.pageSize,itemName:this.itemName,orgId:this.$route.query.orgId},
            success: suCb,
            error: erCb
          };
        that.$https(req);
      },
      // 编辑按钮 事件处理函数
      edit(tab) {
        this.editBtn = !this.editBtn;
      },
      //保存
      commits(n1,n2,n3){
        console.log(n1+"--------"+n2)
        let that = this,
          suCb = res => {
            console.log(res.data);
            that.$msg('保存成功')
          },
          erCb = function(res) {
            console.log(res);
          },
          req = {
            url: "/api/web/proTeam/editTeamSettlementPrice",
            methods: "post",
            data: {price:n1,priceId:n2,orgId:this.$route.query.orgId,itemId:n3},
            success: suCb,
            error: erCb
          };
        that.$https(req);
      }
    }
  };
</script>

<style scoped>
  .component-searchHeader .search-header {
    width: 1100px;
    box-sizing: border-box;
    border: 1px solid rgba(228, 228, 228, 1);
    background-color: rgba(255, 255, 255, 1);
    margin: 20px auto 0;
  }

  .component-searchHeader .search-header .left-title {
    display: flex;
    justify-content: space-between;
    width: 100%;
    background-color: rgba(243, 243, 243, 1);
    height: 45px;
    box-sizing: border-box;
  }

  .component-searchHeader .search-header .left-title .left-text {
    width: 20%;
    color: #666;
    line-height: 45px;
    font-family: "微软雅黑";
    font-weight: 400;
    font-size: 12px;
    text-align: left;
    margin: 0 0 0 30px;
  }
  .left-text .text_span{
    display: inline-block;
    border:1px solid #CCCCCC;
    padding: 0px 10px;
    line-height: 30px !important;
    cursor: pointer;
    background: #fff;
    float: right;
    margin-top: 5px;
    margin-right: 10px;
  }

  .component-searchHeader .right {
    width: 70%;
    display: flex;
    justify-content: flex-end;
    margin-right: 30px;
  }

  .component-searchHeader .right button {
    padding: 0 15px;
    height: 30px;
    margin: 6px 5px;
    line-height: 30px;
    font-size: 12px;
    color: #666;
    background-color: #fff;
    border: 1px solid #ccc;
  }

  .component-searchHeader .right button:hover {
    background-color: #f3f3f3;
  }
  .component-listHeader .search-header {
    width: 1100px;
    box-sizing: border-box;
    border: 1px solid rgba(228, 228, 228, 1);
    border-bottom: none;
    background-color: rgba(255, 255, 255, 1);
    margin: 30px auto 0;
  }

  .component-listHeader .search-header .left-title {
    display: flex;
    justify-content: space-between;
    width: 100%;
    background-color: rgba(243, 243, 243, 1);
    height: 45px;
    box-sizing: border-box;
  }

  .component-listHeader .search-header .left-title .left-text {
    width: 20%;
    color: #666;
    line-height: 45px;
    font-family: "微软雅黑";
    font-weight: 400;
    font-size: 12px;
    text-align: left;
    margin: 0 0 0 30px;
  }

  .component-listHeader .search-header .right {
    width: 70%;
    display: flex;
    justify-content: flex-end;
    margin-right: 10px;
  }

  .component-listHeader .search-header .right button {
    padding: 0 15px;
    height: 30px;
    width: 110px;
    margin: 6px 5px;
    line-height: 30px;
    font-size: 14px;
    color: #1abc9c;
    background-color: #fff;
    border: 1px solid #ccc;
  }
  .el-form-item {
    width: 310px;
    margin-bottom: 20px !important;
  }
  .component-listHeader .search-header .right button:hover {
    background-color: #1abc9c;
    color: #fff;
  }
  .component-listHeader .search-header .right .right-select-margin {
    margin-top: 8px;
    margin-right: 8px;
  }
  /* 处理a链接 */
  a {
    text-decoration: none;
    color: #1abc9a;
  }
  a:hover {
    cursor: pointer;
  }

  .component-makeBudget .tabs-header {
    width: 1150px;
    box-sizing: border-box;
    margin: 0 auto 0;
  }

  .fl_container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
  }
  .fl_container .fl_left {
    text-align: left;
  }
  .fl_container .fl_right {
    text-align: right;
  }

  /* 表格部分 */
  .budget {
    margin-top: 20px;
    width: 100%;
    overflow: hidden;
    background: #f8f8f8;
    height: 35px;
    line-height: 35px;
    font-size: 14px;
    border: 1px solid #e4e4e4;
    border-bottom: none;
    padding: 0 20px;
    box-sizing: border-box;
    font-size: 14px;
    color: #666;
  }
  .gcl .title {
    background: #f8f8f8;
    height: 35px;
    line-height: 35px;
    color: #666;
    padding: 0 20px;
    font-size: 14px;
    border: 1px solid #e4e4e4;
    border-bottom: none;
    text-align: left;
  }
  .budget .title {
    float: left;
  }
  .budget div:last-of-type {
    float: right;
  }
  .gcl .tabs {
    width: 1060px;
    margin: 20px;
    box-sizing: border-box;
  }

  .budgetTable table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    margin: 0 0 20px 0;
    padding: 0;
    border: none;
    font-size: 12px;
  }
  .budgetTable table td,
  th {
    height: 40px;
  }

  th {
    background-color: #f9fafc;
  }

  .gcl_footer {
    text-align: right;
    margin: 20px 0 0 0;
  }

  .gcl_footer .gcl_footer_bottom span {
    color: #1abc9c;
  }

  .gcl_footer .gcl_footer_bottom {
    margin-bottom: 10px;
    margin-right: 2px;
    font-size: 19px;
  }

  /* 双表格容器 */
  .dbTable {
    width: 1100px;
    margin: 0 auto;
    box-sizing: border-box;
    border: 1px solid #eee;
    border-top:none;
    display: flex;
    justify-content: space-around;
  }

  .dbTable .budgetTable {
    width: 500px;
  }

  .component-model .component-listHeader .search-header {
    width: 900px;
    box-sizing: border-box;
    border: 1px solid rgba(228, 228, 228, 1);
    background-color: rgba(255, 255, 255, 1);
    margin: 20px auto 0;
    border-bottom: 0;
  }

  .component-model .component-listHeader .search-header .left-title {
    display: flex;
    justify-content: space-between;
    width: 100%;
    background-color: rgba(243, 243, 243, 1);
    height: 45px;
    box-sizing: border-box;
  }

  .component-model .component-listHeader .search-header .left-title .left-text {
    width: 20%;
    color: #666;
    font-family: "微软雅黑";
    font-weight: 400;
    font-size: 12px;
    line-height: 45px;
    text-align: left;
    margin: 0 0 0 30px;
  }

  .component-model
  .component-listHeader
  .search-header
  .right
  .right-select-margin {
    margin-top: 6px;
    margin-right: 8px;
  }

  .component-model .table {
    width: 100%;
    margin: 0 auto;
  }

  .underTable {
    width: 100%;
    margin: 25px 0 0 15px;
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
  }

  .tableTitle {
    text-align: center;
    margin: 15px auto;
  }
  .component_btnGroup {
    margin: 0 auto;
    padding: 20px;
    text-align: left;
    width: 1100px;
    box-sizing: border-box;
    border: 1px solid #eee;
    border-bottom: none;
  }
</style>
